home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.c
- Path: owl3.office-workstations-ltd.co.uk!not-for-mail
- From: kenn@office-workstations-ltd.co.uk (Ken Nicolson)
- Subject: Re: Help to detect error
- Message-ID: <316bb36d.1950327@newshost>
- Date: Wed, 10 Apr 1996 13:17:55 GMT
- References: <DpMA82.KEE.0.bloor@torfree.net>
- Organization: Office Workstations Limited
- Reply-To: kenn@owl-uk.co.uk
- X-Newsreader: Forte Agent .99d/32.182
-
- bz786@torfree.net (Sherif Asif) wrote:
-
- >I am using unix compiler and I get the following error message
- >II am learing on my own please help me. Last time when I posted I got
- >lots of reply . Thanks .
- >line 6: syntax error at or near type word "int"
- >line 20: syntax error at or near type word "int"
- >line 23: n undefined
- >line 25: syntax error at or near word "if"
- >line 26: x undefined
- >
- >#include <stdio.h>
- >/*reoder 1 dim array, int array from smallest to largest*/
- >main()
- >{
- >int i, n, x[100];
- >reorder (int n , int x[]); /* LINE 6 */
- Judging by your errors, I think you have a non-ANSI C compiler that only
- accepts old-style K&R-1 function declarations. I suggest you try to obtain
- a newer one.
-
- However, if you cannot do this, you will need:
-
- void reorder (); /* LINE 6 */
-
- and
-
- void reorder (n, x) /* LINE 20 */
- int n, x[];
- {
- ...
-
- >for (i=item+1; i<n;++i/
- ^
- Should be ")"
- for (i=item+1; i<n;++i)
-
- I've made the function void as you never return a value from it.
-
- Hope this helps!
-
- Ken
-
-